abstract class $VEC{ET < $NFE{ET}, VT < $VEC{ET,VT}} |
---|
**** |
_ The specification of the general vector class. _ c.f. $MAT{*,*,*} This is mostly straightforward except for a small trickiness: complex vectors still need to have lengths which return real numbers, and not CPX. (ben) However, the length in a complex vector has to be the same as the type of the components of the complex, since this fact is used in some of the functions. _ the vector type should not need to know about its companion, matrix type, though the matrix type does know about the vector type. Hence, all matrix-vector operations are in the matrix class and not the vector class. _ |
$VEC{_,_,_} | VEC | VECD | VECCPXD | VECCPX |
aget(i:INT):ET; |
---|
**** |
_ Get the projection of the vector in the i'th direction. _ |
array: ARRAY{ET}; |
---|
**** |
_ result := An array of same dimensionality with projections of this vector upon each axis. _ |
aset(i:INT,s:ET); |
---|
**** |
_ Set the projection of the vector in the i'th direction. _ |
copy:VT; |
---|
**** |
_ result := copy of self. Creates new return value. _ Example: v2 ::= v.copy; |
create(sz:INT):VT; |
---|
**** |
result := "new vector size 'sz' " |
create(arg:VT):VT; |
---|
**** |
_ result := "new vector same size as arg" _ |
dim:INT; |
---|
**** | The number of dimensions. |
inplace_arg_minus_arg(arg1,arg2:VT); |
---|
**** |
_ self := arg1 - arg2 _ Example: a,b,c:VEC; c.inplace_arg_minus_arg(a,b); |
inplace_arg_plus_arg(arg1,arg2:VT); |
---|
**** |
_ self := arg1 + arg2 _ Example: a,b,c:VEC; c.inplace_arg_plus_arg(a,b); |
inplace_arg_plus_scaled_arg(arg1:VT,s:ET,arg2:VT); |
---|
**** |
_ self := arg1 + s*arg2; _ Example: a,b,c:VEC; c.inplace_arg_plus_scaled_arg(a,3.1415d0,b); |
inplace_contents(arg:VT); |
---|
**** |
_ "array portion of self" := "array portion of arg" _ Example: v2.inplace_contents(v); |
inplace_contents_from_function(function:ROUT{INT}:ET); |
---|
**** |
"array portion of self"(i) = function(i) all i _ |
inplace_contents_subspace(destbeg,n,srcbeg:INT,arg:VT); |
---|
**** |
_ Assign the components of 'arg' from [srcbeg,srcbeg+n-1] to 'self' from [destbeg,destbeg+n-1]. For vectors of elementary value objects, this means "copy elements". _ |
inplace_elements(arg:ET); |
---|
**** |
make self be 'arg' in all directions. _ |
inplace_minus_arg(arg:VT); |
---|
**** |
_ self := self - arg. _ Example: a,b:VEC; a.inplace_minus_arg(b); |
inplace_plus_arg(arg:VT); |
---|
**** |
_ self := self + arg. _ Example: a,b:VEC; a.inplace_plus_arg(b); |
inplace_plus_scaled_arg(s:ET,arg:VT); |
---|
**** |
_ self := self + s*arg; _ Example: a,b:VEC; a.inplace_plus_scaled_arg(3.0d0,b); |
inplace_scaled_by(s:ET); |
---|
**** |
_ self := self * s; _ Example: v.inplace_scaled_by(4.0d0); |
inplace_swapped(arg:VT); |
---|
**** |
_ Swap contents of self with same sized "arg". _ Example: v2.swap(v1); |
inplace_unit_vector(i:INT); |
---|
**** |
make "self" the unit vector in the 'ith' direction. i in [0,dim-1]. |
is_eq(arg:VT):BOOL; |
---|
**** |
Return true if 'arg = self' |
minus(arg:VT):VT; |
---|
**** |
_ result (created) := self + arg. _ Example: a,b,c:VEC; c := a - b; Sugar for "a - b", synonym for "minus_arg". |
minus_arg(arg:VT):VT; |
---|
**** |
_ result (created) := self - arg. _ Example: a,b,c:VEC; c := a - b; |
plus(arg:VT):VT; |
---|
**** |
_ result (created) := self + arg. _ Example: a,b,c:VEC; c := a + b; Sugar for "a + b", synonym for "plus_arg". |
plus_arg(arg:VT):VT; |
---|
**** |
_ result (created) := self + arg. _ Example: a,b,c:VEC; c := a + b; |
plus_scaled_arg(s:ET,arg:VT):VT; |
---|
**** |
_ result := self + s*arg; _ Example: a,b,c:VEC; c := a.plus_scaled_arg(3.0d0,b); |
same_size(arg:VT):BOOL; |
---|
**** |
true if arg has the same size as self. Is false if either 'self' or 'arg' is void or even both. Intent is to be useful in preconditions. |
scaled_by(s:ET):VT; |
---|
**** |
_ result (created) := self * s; _ Example: m2 ::= m * 0.40d0; _ |
str:STR; |
---|
**** |
_ result := "a string representation of self" _ |
times(s:ET):VT; |
---|
**** |
_ result (created) := self * s; _ Example: v2 ::= v * 0.40d0; Sugar for "vec * scalar", synonym for 'scaled_by'. |